#部署 TiDB 集群
kubectl create namespace tidb-cluster
kubectl -n tidb-cluster apply -f https://ghproxy.net/raw.githubusercontent.com/pingcap/tidb-operator/master/examples/basic-cn/tidb-cluster.yaml

#部署 TiDB 集群监控
# kubectl -n tidb-cluster apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/examples/basic-cn/tidb-monitor.yaml
kubectl -n tidb-cluster apply -f https://ghproxy.net/raw.githubusercontent.com/pingcap/tidb-operator/master/examples/basic-cn/tidb-monitor.yaml

# 部署 Dashboard
kubectl -n tidb-cluster apply -f https://ghproxy.net/raw.githubusercontent.com/pingcap/tidb-operator/master/examples/basic-cn/tidb-dashboard.yaml

# kubectl -n tidb-cluster apply -f ./monitor.yaml
kubectl -n tidb-cluster apply -f ./ngmonitoring.yaml
# kubectl -n tidb-cluster apply -f ./dashboard.yaml
# 集群初始化
kubectl -n tidb-cluster apply -f ./initializer.yaml
# #修改 TiDB 集群版本
# kubectl patch tc basic -n tidb-cluster --type merge -p '{"spec": {"version": "release-4.0-nightly"} }'

# #转发 TiDB 服务端口
# kubectl port-forward -n tidb-cluster svc/basic-tidb 4000 > pf4000.out &
# #检查 TiDB 集群版本
# mysql -h 127.0.0.1 -P 4000 -u root -e 'select tidb_version()\G'

# set global tidb_enable_noop_functions=1
